/**
 * 
 */
package design_pattern.decorator.order;

import java.text.NumberFormat;

/**
 * @author linzq
 * 
 */
public class OrderLine {

  private int units;

  private double unitPrice;

  private String itemName;

  public void print() {

  }

  public void printLine() {
    System.out.println(
            "\t" + units + "\t" + formatCurrency(unitPrice) + "\t" + formatCurrency(getSubTotal()));
  }

  public String formatCurrency(double total) {
    return NumberFormat.getCurrencyInstance().format(total);
  }

  public double getSubTotal() {
    return units * unitPrice;
  }

  public int getUnits() {
    return units;
  }

  public void setUnits(int units) {
    this.units = units;
  }

  public double getUnitPrice() {
    return unitPrice;
  }

  public void setUnitPrice(double unitPrice) {
    this.unitPrice = unitPrice;
  }

  public String getItemName() {
    return itemName;
  }

  public void setItemName(String itemName) {
    this.itemName = itemName;
  }
}
